import {Entity} from "../../entity";
import {Alias, Column, Editor, Enum, Serialize} from "../../decorator";

export enum CustomerLevel {
    Normal = 0,
    Friendly = 1,
    VIP = 2
}

//客户
export class Customer extends Entity {

    @Editor("String")
    @Alias("客户名称")
    @Serialize("name")
    public name: string = "";

    @Editor("String")
    @Alias("客户编码")
    @Serialize("code")
    public code: string = "";

    @Editor("Memo")
    @Alias("客户描述")
    @Serialize("description")
    public description: string = "";

    @Editor("Enum")
    @Enum(CustomerLevel)
    @Alias("客户级别")
    @Serialize("level")
    public level: number = CustomerLevel.Normal;  //0 一般客户 1 优惠客户  2 VIP

    @Editor("String")
    @Alias("联系人")
    @Serialize("person")
    public person: string = "";

    @Editor("String")
    @Alias("联系电话")
    @Serialize("phone")
    public phone: string = "";

    @Editor("String")
    @Alias("联系地址")
    @Serialize("address")
    public address: string = "";

    @Editor("String")
    @Alias("单位名称")
    @Serialize("company")
    public company: string = "";

    @Editor("String")
    @Alias("单位税号")
    @Serialize("tax")
    public tax: string = "";

    @Editor("String")
    @Alias("单位电话")
    @Serialize("tel")
    public tel: string = "";

    constructor() {
        super();
    }

    fromJSON(obj) {
        super.fromJSON(obj);
    }

    toJSON(): any {
        return super.toJSON();
    }

}


